﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Text;

public partial class Controls_UserView : System.Web.UI.UserControl
{
    private string _html;
    public string HTML
    {
        set { _html = value; }
        get { return _html; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        GetHtml();
    }
    private void GetHtml()
    {
        if (Request.Cookies["View"] != null)
        {
            StringBuilder Sb = new StringBuilder();
            string productlist = Request.Cookies["View"]["ProductID"];
            string timelist = Request.Cookies["View"]["Time"];
            DataTable dt = new BLL.SHANGPIN().Get_UserViewList(productlist, timelist);
            if (dt.Rows.Count > 0)
            {
                Sb.Append("<div class=\"r_left_news_top\"><h2>你浏览过的商品</h2></div>");
                Sb.Append("<div class=\"r_left_news_middle2\"><ul class=\"r_tp\">");
                foreach (DataRow dr in dt.Rows)
                {
                    Sb.Append("<li><a href=\""+BLL.Common.ApplicationPath+"/Product/P_"+dr["SPDM"].ToString()+"_"+dr["CP_COLOR"]+".html\">");
                    Sb.Append("<img src=\"" + BLL.Common.GetProductPicPath("com") + BLL.Common.GetPath(dr["CP_PICPATH"].ToString()) + dr["CP_PICPATH"].ToString() + "\" width=\"65\" height=\"65\" />");
                    Sb.Append("<br/>");
                    Sb.Append("<span>"+BLL.Common.GetSubString(dr["SPMC"].ToString(),0,5,"...")+"</span>");
                    Sb.Append("<br/>");
                    Sb.Append("<span>"+dr["SPDM"].ToString()+"</span>");
                    Sb.Append("</a></li>");                            
                }
                Sb.Append("</ul>");
                Sb.Append("<div class=\"clear\"></div>");
                Sb.Append("</div>");
                Sb.Append("<div class=\"r_left_news_bottom\"></div>");
                HTML=Sb.ToString();
            }
        }
    }
    
}
